package com.own.business.system.menu.entity.bo;

import com.own.business.system.menu.entity.po.SystemUserRole;
import com.own.component.common.base.entity.BaseBo;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.io.Serializable;

/**
 * SystemUserRoleBo
 *
 * @author chenxueli
 * @date 2024-03-31 10:00:18
 */
@Schema(title = "系统用户角色" + ConstantBeanSuffix.BO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class SystemUserRoleBo extends BaseBo<SystemUserRole> implements Serializable {

    /**
     * 用户id
     */
    private Long userId;

    /**
     * 角色id
     */
    private Long roleId;

    /**
     * 转持久化对象
     *
     * @param entity 原持久化对象
     * @return 持久化对象
     */
    @Override
    public SystemUserRole toPo(SystemUserRole entity) {
        if (entity == null) {
            entity = new SystemUserRole();
        }
        entity.setFkUserId(this.userId);
        entity.setFkRoleId(this.roleId);
        return super.toPo(entity);
    }

}

